﻿using System.Data;
using System.Data.SqlClient;

SqlConnection connection = new("server=.;uid=sa;pwd=Wgzwgz111420;database=unit21");

// 创建适配器
SqlDataAdapter adapter = new SqlDataAdapter();
// 创建命令对象
adapter.SelectCommand = new SqlCommand("select * from product",connection);

DataSet dataSet = new();
adapter.Fill(dataSet);

Console.WriteLine(dataSet.Tables[0].Rows.Count);